package com.yekaile.carsystem.controller;


import com.yekaile.carsystem.controller.vo.MenuVO;
import com.yekaile.carsystem.service.UserService;
import com.yekaile.carsystem.util.Result;
import lombok.AllArgsConstructor;
import org.apache.http.HttpStatus;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @author yekaile
 */
@RestController
@RequestMapping("permission")
@AllArgsConstructor(onConstructor_=@Autowired)

public class PermissionController {


    private final UserService userService;



    @GetMapping("getAllPermission")
    @RequiresPermissions("authority:distribution")
    public Result<Set<MenuVO>>listAllPermission(){
        Set<MenuVO> allMenuVO = userService.getAllMenuVO();
        return new Result<>(HttpStatus.SC_OK,"查找成功",allMenuVO);
    }
}
